package com.atguigu.gmall.all.controller;

import com.atguigu.gmall.model.order.OrderInfo;
import com.atguigu.gmall.order.client.OrderInfoFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author 李旭
 * @date 2021/10/27 9:15
 * @Description:
 *
 * 支付页面
 */
@Controller
public class PayController {


    @Autowired
    private OrderInfoFeignClient orderInfoFeignClient;
    //去支付页面
    @GetMapping("/pay.html")
    public String pay(Long orderId, Model model){

        OrderInfo orderInfo = orderInfoFeignClient.getOrderInfo(orderId);
        //订单的ID
        //订单的金额
        model.addAttribute("orderInfo",orderInfo);
        return "payment/pay";
    }

    //跳转到商户的成功页面
    @GetMapping("/pay/success.html")
    public String success(){
        return "payment/success";
    }
}
